#ifndef ANIMATIONOBJ_H
#define ANIMATIONOBJ_H

struct animationObj{
    int frame,maxframe,step,stepSize;
    animationObj():frame(0),maxframe(100),step(1),stepSize(1){}
    void reset(){frame=step>0?0:maxframe;}
    void playForward(){step=stepSize;}
    void playReverse(){step=-stepSize;}
    void stop(){step=0;}
    bool stopped(){return step==0;}
    bool forward(){return step>0;}
    bool reverse(){return step<0;}
    bool finished(){return (step>0 && frame >= maxframe) || (step<0 && frame <= 0);}
    void nextFrame(){if(finished() || stopped())return; frame+=step;}
    void render(){}
};

#endif // ANIMATIONOBJ_H
